<script setup>
import { ref } from 'vue';

defineProps({
  msg: {
    type: String,
    required: true,
  },
  name: String
})


const age = ref(23)
const emits = defineEmits(['e-age']) // 自定义事件

const sendData = () =>{
  emits('e-age', age.value) // 触发事件，传递数据
}
</script>

<template>
  <p>{{ msg }}</p>
  <p>{{ name }}</p>

  <button @click="sendData">子组件向父组件传递数据</button>
</template>

<style scoped>
</style>
